package com.nf.action;

import com.nf.entity.User;
import com.nf.service.UserService;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import java.util.List;

@Controller
@Scope("prototype")

public class UserAction extends ActionSupport {

    @Autowired
    private UserService userService = null;


    @Override
    public String execute() throws Exception {
        List<User> userList = userService.getAllUser();
        System.out.println(userList.size());

        ActionContext.getContext().getValueStack().set("userList",userList);
        return this.SUCCESS;
    }
}
